<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for src/assets/octopus/engine/tips.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="..\..\..\..\prettify.css" />
    <link rel="stylesheet" href="..\..\..\..\base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(..\..\..\..\sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="..\..\..\..\index.html">All files</a> / <a href="index.html">src/assets/octopus/engine</a> tips.js
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>0/33</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>0/20</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>0/13</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>0/33</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">function <span class="fstat-no" title="function not covered" >oTipsEngine(engine) {</span>
<span class="cstat-no" title="statement not covered" >  this.engine = engine;</span>
}
&nbsp;
oTipsEngine.prototype = {
  // 渲染Tips，延迟100毫秒以后执行。
  render: <span class="fstat-no" title="function not covered" >function () </span>{
<span class="cstat-no" title="statement not covered" >    setTimeout(<span class="fstat-no" title="function not covered" >function () </span>{</span>
      // 渲染注册Bootstrap组件
<span class="cstat-no" title="statement not covered" >      $('[data-toggle="tooltip"]').tooltip();</span>
<span class="cstat-no" title="statement not covered" >      $('[data-toggle="popover"]').popover();</span>
    }, 100);
  },
  // 白色
  debug: <span class="fstat-no" title="function not covered" >function (</span>val) {
    // console.log(this.engine.config.model); // 此处已经能获取到配置信息，在request中已经实现。
    // 只有调试模式才打印输出。
<span class="cstat-no" title="statement not covered" >    if (this.engine.config.model == "debug") {</span>
<span class="cstat-no" title="statement not covered" >      this.renderTips("alert", val);</span>
    }
  },
  // 绿色
  success: <span class="fstat-no" title="function not covered" >function (</span>val) {
<span class="cstat-no" title="statement not covered" >    this.renderTips("success", val);</span>
  },
  // 黄色
  warning: <span class="fstat-no" title="function not covered" >function (</span>val) {
<span class="cstat-no" title="statement not covered" >    this.renderTips("warning", val);</span>
  },
  // 红色
  error: <span class="fstat-no" title="function not covered" >function (</span>val) {
<span class="cstat-no" title="statement not covered" >    this.renderTips("error", val);</span>
  },
  // 蓝色
  info: <span class="fstat-no" title="function not covered" >function (</span>val) {
<span class="cstat-no" title="statement not covered" >    this.renderTips("info", val);</span>
  },
  // 渲染
  renderTips: <span class="fstat-no" title="function not covered" >function (</span>type, val) {
    // 控制台输出变量
    let consoleText = <span class="cstat-no" title="statement not covered" >"[" + this.engine.tools.date("yyyy-MM-dd HH:mm:ss") + "]";</span>
    // 如果是对象，则追加状态代码
<span class="cstat-no" title="statement not covered" >    if (val.status != undefined) {</span>
<span class="cstat-no" title="statement not covered" >      consoleText += "[" + val.status.code + "]";</span>
<span class="cstat-no" title="statement not covered" >      val = val.status.message;</span>
    }
    // 追加提示信息
<span class="cstat-no" title="statement not covered" >    consoleText += val;</span>
&nbsp;
    // 基础消息不弹框，因为也来不及看，直接打印在日志即可。
<span class="cstat-no" title="statement not covered" >    if (type == "alert" || type == "info") {</span>
<span class="cstat-no" title="statement not covered" >      console.log(consoleText);</span>
    } else {
<span class="cstat-no" title="statement not covered" >      if (type == "warning") {</span>
<span class="cstat-no" title="statement not covered" >        console.warn(consoleText);</span>
      } else <span class="cstat-no" title="statement not covered" >if (type == "success") {</span>
<span class="cstat-no" title="statement not covered" >        console.info(consoleText);</span>
      } else <span class="cstat-no" title="statement not covered" >if (type == "error") {</span>
<span class="cstat-no" title="statement not covered" >        console.error(consoleText);</span>
      }
      // 如果是手机端
<span class="cstat-no" title="statement not covered" >      if (this.engine.tools.isMobile()) {</span>
<span class="cstat-no" title="statement not covered" >        this.engine.vue.$toast(val);</span>
      }
      // 如果是Web端
      else {
        // use element-ui's tips control
<span class="cstat-no" title="statement not covered" >        this.engine.vue.$message({</span>
          showClose: true,
          message: val,
          type: type
        });
      }
    }
  },
  // 弹出面板消息
  message: <span class="fstat-no" title="function not covered" >function (</span>content, title) {
<span class="cstat-no" title="statement not covered" >    if (this.engine.tools.isMobile()) {</span>
<span class="cstat-no" title="statement not covered" >      this.engine.vue.$dialog.alert({message: content});</span>
    } else {
<span class="cstat-no" title="statement not covered" >      this.engine.vue.$alert(content, title || "消息");</span>
    }
  },
  // 确认面板
  confirm: <span class="fstat-no" title="function not covered" >function () <span class="cstat-no" title="statement not covered" ></span>{</span>
<span class="cstat-no" title="statement not covered" >    this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {</span>
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning'
    }).then(<span class="fstat-no" title="function not covered" >() =&gt; </span>{
<span class="cstat-no" title="statement not covered" >      this.$message({</span>
        type: 'success',
        message: '删除成功!'
      });
    }).catch(<span class="fstat-no" title="function not covered" >() =&gt; </span>{
<span class="cstat-no" title="statement not covered" >      this.$message({</span>
        type: 'info',
        message: '已取消删除'
      });
    });
  },
}
&nbsp;
export {
  oTipsEngine
}
&nbsp;
&nbsp;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Jan 20 2020 17:54:15 GMT+0800 (GMT+08:00)
</div>
</div>
<script src="..\..\..\..\prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="..\..\..\..\sorter.js"></script>
</body>
</html>
